SNSF initial DMP data

Descriptive statistics and figures

Author

G.Fraga Gonzalez

Published

January 16, 2024

Descriptive statistics

Code
library(purrr)
 
# paths
dirinput <- file.path(getwd())
fileinput <- 'SNSF_ORD_monitoring_report_2017-2018_dataset.xlsx'
sheet_apps <- 'Data_applications'
sheet_repo <- 'Data_repositories'

# read tables 
tbl_apps <- as.data.frame(readxl::read_xlsx(fileinput,sheet = sheet_apps))
tbl_repo <- as.data.frame(readxl::read_xlsx(fileinput,sheet = sheet_repo))

The input file: SNSF_ORD_monitoring_report_2017-2018_dataset.xlsx was downloaded from https://zenodo.org/records/3618209

The table in sheet Data_applications has 1516 rows and 9 columns.

Code
library(htmltools)
library(dplyr)
library(plotly)
library(crosstalk) # this package makes it possible to filter 
library(DT)

# Create object that will be shared by filter panels, datatable and plots
shared_tbl <- SharedData$new(tbl_apps, group = "shared_obj")

# filter panels. Other formats are sliders and checkboxes https://rstudio.github.io/crosstalk/using.html
#--------------------------------------------------------------------------------
bscols(
  widths = c(2,3,3,3,3),
   device = c("xs", "sm", "md", "lg"),
   filter_checkbox( id = "Division", label = "Division",sharedData = shared_tbl, group = ~Division, inline=FALSE),
   filter_select(id = "repository", label = "Filter by Repository",sharedData = shared_tbl, ~`Data repository`),
   filter_select(id = "categories", label = "Filter by Sharing Category",sharedData = shared_tbl, ~`Categories`),
   filter_select(id = "dmpcheck", label = "Filter by DMP check",sharedData = shared_tbl, ~`DMP check`),
   filter_select(id = "dmpsubmit", label = "Filter by DMP submission",sharedData = shared_tbl, ~`DMP submitted`)
  
)
Code
# Plot
#--------------------------------------------------------------------------------
bscols(
  widths = c(6,6),     
  plot_ly(shared_tbl, y = ~`Budgeted ORD costs`, x = ~Division, color=~Division) %>% 
      add_markers(),
  plot_ly(shared_tbl,  x = ~`DMP check`, color=~Division,alpha = 0.6) %>%
     add_histogram(),
  tags$hr(),
  tags$hr()
)


Code
tags$hr()

Code
# table
#--------------------------------------------------------------------------------
datatable(
    shared_tbl,
    filter = "top", 
    rownames = FALSE,
    class = 'compact cell-border hover stripe',
    extensions = c('Buttons', 'ColReorder', 'Scroller',  'KeyTable'),
    selection = 'none',
    options = list(
      initComplete = JS("function(settings, json) {$(this.api().table().header()).css({'font-size' : '80%'});}"), #reduce header font
      dom = 'Bfrtip',
      buttons = list('copy'),
      scrollX = TRUE,
      scrollY = "400px",
      colReorder = TRUE 
      )
  ) %>%
  DT::formatStyle(columns = c(1:9), fontSize = '75%') 

The table: Data_repositories has 146 rows and 4 columns.